package com.labichaoka.chaoka.ui.baseinfo.information;

import com.labichaoka.chaoka.entity.CreditCardResponse;
import com.labichaoka.chaoka.entity.IDCardResponse;
import com.labichaoka.chaoka.entity.VerifyInfoListResponse;

/**
 * Created by ruan on 2018/8/2.
 */

public class InformationAuthenticationPresenterImpl implements InformationAuthenticationPresenter,InformationAuthenticationInteractor.OnFinishedListener{
    private InformationAuthenticationView informationView;
    private InformationAuthenticationInteractor informationInteractor;

    public InformationAuthenticationPresenterImpl(InformationAuthenticationView v,InformationAuthenticationInteractor interactor){
        this.informationInteractor=interactor;
        this.informationView=v;
    }

    @Override
    public void getVerifyInfoList() {
        if (informationView!=null){
            informationView.showProgress();
        }
        informationInteractor.getVerifyInfoList(this);
    }

    @Override
    public void getIdName() {
        if (informationView!=null){
            informationView.showProgress();
        }
        informationInteractor.getIdName(this);
    }

    @Override
    public void behavior(String actionNode) {
        informationInteractor.behavior(actionNode);
    }

    @Override
    public void creditCardSwitch() {
        if (informationView!=null){
            informationView.showProgress();
        }
        informationInteractor.creditCardSwitch(this);
    }

    @Override
    public void onDestroy() {
        informationView=null;
    }


    @Override
    public void onGetVerifyInfoListSucc(VerifyInfoListResponse response) {
        informationView.hideProgress();
        informationView.getVerifyInfoListCallback(response);
    }

    @Override
    public void onGetVerifyInfoListFailed() {
        informationView.hideProgress();
    }

    @Override
    public void onGetIdNameSuccessed(IDCardResponse response) {
        informationView.hideProgress();
        informationView.getIdNameCallBack(response);
    }

    @Override
    public void onGetIdNameFailed() {
        informationView.hideProgress();
    }

    @Override
    public void onCreditCardSucc(CreditCardResponse response) {
        informationView.hideProgress();
        informationView.creditCardSwitchCallback(response);
    }

    @Override
    public void onCreditCardFailed() {
        informationView.hideProgress();
    }
}
